package com.newenergy.wisehome.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;
import com.newenergy.wisehome.R;
import com.newenergy.wisehome.data.bean.BallLight;

import java.util.List;

/**
 *
 * Created by kyx on 2018/1/31.
 */

public class HandsetRoomAdapter extends RecyclerArrayAdapter<BallLight> {

    private Context mContext;

    public void refreshData(List<BallLight> datas) {
        clear();
        if (datas != null && datas.size() > 0) {
            addAll(datas);
        }
        notifyDataSetChanged();
    }

    public HandsetRoomAdapter(Context context) {
        super(context);
        mContext=context;
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViewHolder(parent);
    }

    private class ViewHolder extends BaseViewHolder<BallLight> {

        private TextView tvName;

        public ViewHolder(ViewGroup parent) {
            super(parent, R.layout.list_handset_room);
            tvName = $(R.id.tv_name);
        }

        @Override
        public void setData(BallLight data) {
            super.setData(data);
            tvName.setText(data.getName());

        }
    }


}
